<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			//7. 打印10层杨辉三角，请百度了解杨辉三角。
			var arr = [
				[1],
				[1,1]
				//[1, 2, 1],
				//[1,3,3,1]
				//[1,4,6,4,1]
			];
			for (var i = 2; i < 10; i++) {
				var temp = [];
				temp[0] = 1;
				temp[i] = 1;

				for (var j = 1; j < i; j++) {
					temp[j] = arr[i - 1][j - 1] + arr[i - 1][j];
				}
				arr[i] = temp;
			}


			for (var value of arr) {
				var str = '';
				for (var v of value) {
					str += v + " ";
				}
				console.log(str);
			}
		</script>
	</body>
</html>
